package org.example.tree;


/**
 * @author liyishan
 * @date 2024/3/23 09:28
 * @apiNote
 */

public class Test00226InvertTree {

    public TreeNode invertTree(TreeNode root) {
        if(root == null){
            return null;
        }
        invertTree(root.left);
        invertTree(root.right);
        TreeNode temp = root.left;
        root.left = root.right;
        root.right = temp;
        return root;
    }
}
